package cn.edu.scau.cmi.xiaozecheng.singleton;

/**
 * @author xiao
 */
public class Chairman {
	//1.私有构造方法
	private Chairman(String name) {
		this.name = name;
	}
	//2私有.静态实例
	private static Chairman chairman;
	private String name;
	//3.公有静态获取实例方法 判定实例是否已经创建，如果没有创建，先创建再返回，否则直接返回。
	public static Chairman getInstance(String name) {
		if (chairman == null) {
			chairman = new Chairman(name);
			return chairman;
		} else {
			return chairman;
		}
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public static void clearInstance() {
		chairman = null;
	}

}
